package com.example.zheng.qq.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import java.util.List;

public class PageAdapter extends PagerAdapter{
    private List<ImageView> pageView;
    public PageAdapter(List<ImageView> view){
        this.pageView=view;
    }
    @Override
    public int getCount() {
        return pageView.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(pageView.get(position));
        return pageView.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(pageView.get(position));

    }
}
